<?php
if(!isset($GLOBALS['_vars'])) $GLOBALS['_vars'] = array(); 
$fields = array();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
if(empty($action))
{
?>
<title>所有自助广告位列表 - <?php echo $cfg_webname; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="templets/js/j.js"></script>
<script type="text/javascript" language='javascript' src='templets/js/main.js'></script>
<script type="text/javascript" language="javascript" src="../include/dedeajax2.js"></script>
<script type="text/javascript" src="templets/js/table_function.js"></script>
<script type="text/javascript" src="templets/js/leftmenu.js"></script>
<script type="text/javascript">
<!--
function CloseEditCatalog(){
	$Obj('editCatalog').style.display='none';
}
function Lookuser(cid){
	$Obj('editCatalog').style.display='block';
	var myajax = new DedeAjax($Obj('editCatalogBody'),false,true,"","","请稍候，正在载入...");
	myajax.SendGet2('buyad.php?cid='+cid+'&action=look');
	DedeXHTTP = null;
}
-->
</script>
<link href="templets/style/base.css" rel="stylesheet" type="text/css" />
<style>
<!--
#editCatalog {
	position:absolute;
	left:400px;
	top:0px;
	width:300px;
	height:400px;
	z-index:1;
	background-color: #F2FDDB;
	border:1px solid #889D8F;
	padding:6px;
	display:none
}
-->
</style>
</head>
<body>

<div id="main">
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
  <div id="content" class="w960 clearfix">
	<?php include(DEDEMEMBER."/templets/menu.php"); ?>
      <div id="mcpmain">
        <div id="appTab">
          <ul>
		    <li class="thisTab"><a href="buyad.php">购买广告</a></li>
            <li><a href="myad.php">我的广告</a></li>
			<li><a href="buy.php">管理金币</a></li>
          </ul>
        </div>
        <div id="mainCp">
          <div class="postForm">
            <div class="location">所有广告位列表</div>
            <form action="buyad.php" name="form1" method="get">
            <table border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#FFFFFF" width="100%">
              <tr>
			    <td width="15%">
                  <select name="tid" id="tid">
                     <option value="0">所有分类</option>
                     <?php echo $options?>
                  </select>
                </td>
                <td width="15%">
                  <select name="sales" id="sales">
			          <option value="0">广告状态</option>
                      <option value="1">上架</option>
                      <option value="2">待上架</option>
                  </select>
                </td>
				<td width="15%">
                  <select name="type" id="type">
			           <option value="0">广告类型</option>
                       <option value="1">文字广告</option>
                      <!-- <option value="2">图片广告</option>
			           <option value="3">Flash广告</option>-->
                  </select>
                </td>
                <td width="15%">
                  <select name="price3" id="type">
                    <option value="-1">所有广告</option>
                    <option value="<?php echo $memer['money']; ?>">能购买的</option>
                  </select>
                </td>
                <td width="33%" align="left">
                价格范围：<input type='text' size="2" name="price1" id="price1" style="height:20px;" value="<?php echo $price1?>"> → <input type='text' style="height:20px;" name="price2" id="price2" size="2" value="<?php echo $price2?>"> (金币/周)</td>
				<td width="7%" align="center">
                <button class="button2 mt5 ml10" type="submit">筛选</button></td>
                
              </tr>
           </table>
           </form>
           <table cellspacing="1" class="list" width="100%">
            <thead>
              <tr>
			    <th width="15%">广告位名称</th>
                <th width="15%">所属分类</th>
				<th width="5%">位置</th>
                <th width="5%">类型</th>
                <th width="5%">状态</th>
				<th width="5%">价格</th>
                <th width="10%">到期时间 </th>
				<th width="10%">操作</th>
              </tr>
            </thead>
            <tbody>
<?php
$atts = array();
$atts['tagname'] = 'datalist';
$blockValue = $this->refObj->GetArcList($atts,$this->refObj,$fields); 
if(is_array($blockValue)){
foreach( $blockValue as $key=>$fields )
{
?>
		<tr>
		       <td align="center"> <?php echo $fields['adname']; ?></td>
			  <td align="center"> <?php echo $fields['name']; ?></td>
			 <td align="center"><a href="javascript:Lookuser(<?php echo $fields['cid']?>);" title="广告位置预览" class="thickbox">预览</a></td>
             
              <td align="center"><?php
    	        if($fields['adtype']=='1') echo "文字";
		        else if($fields['adtype']=='2') echo "图片";
		        else echo "Flash";
		        ?></td>
            <td align="center"><?php
    	        if($fields['sales']=='1') echo "上架";
		        else echo "待上架";
		        ?></td>
			<td align="center"><?php echo $fields['price']; ?></td>
            <td align="center"> <?php
    	        if($ntime > $fields['endtime'] || $ntime < $fields['starttime']) 
				{
				?>
               正在出售
				<?php
                 }
		        else 
				{
				 echo GetDateMk($fields['endtime']);
				}?>
			  </td>
				<td align="center">
              <?php if($fields['mcid']=='0'){ ?> 
			     <a href="buyad.php?action=buy&cid=<?php echo $fields['cid'];?>">购买 </a>
			  <?php }if($fields['mcid']!='0'){ if($ntime > $fields['endtime'] || $ntime < $fields['starttime']) { ?> 
                 <a href="buyad.php?action=buy&cid=<?php echo $fields['cid'];?>">购买 </a>
              <?php } else { if ($fields['mcid'] == $mid['mid']){ ?> 
                 已购买 <a href="myad.php?action=edit&cid=<?php echo $fields['cid'];?>" style="color:#FF0000">编辑</a>
              <?php } else echo "已售出"; } } ?>  
            
	
			
				</td>
            </tr>
	<?php
}
}?>
        </tbody>
		<tfoot>
              <tr>
                <td colspan="8">
                <div class="pages mTB10 fRight">
      <?php
$atts = array();
$atts['tagname'] = 'pagelist';
$atts['listitem'] = 'info,index,end,pre,next,pageno';
$atts['listsize'] = '10';
 echo $this->refObj->GetPageList($atts,$this->refObj,$fields); 
?>
 
      </div>
                    <div class="clear"></div>
                  </td>
              </tr>
            </tfoot>
          </table>
<div id="editCatalog">
<span id='editCatalogBody'>请稍候，正在载入...</span>
</div>
		 </div>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</div>
<?php include(DEDEMEMBER."/templets/foot.htm"); 
}elseif($action == 'buy')
{
?>
<title>购买广告位 - <?php echo $cfg_webname; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>" />
<script type="text/javascript" src="templets/js/j.js"></script>
<script type="text/javascript" language='javascript' src='templets/js/main.js'></script>
<script type="text/javascript" language="javascript" src="../include/dedeajax2.js"></script>
<script type="text/javascript" src="templets/js/table_function.js"></script>
<script type="text/javascript" src="templets/js/leftmenu.js"></script>
<link href="templets/style/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
  <div id="content" class="w960 clearfix">
	<?php include(DEDEMEMBER."/templets/menu.php"); ?>
      <div id="mcpmain">
        <div id="appTab">
          <ul>
		    <li class="thisTab"><a href="buyad.php">购买广告</a></li>
            <li><a href="myad.php">我的广告</a></li>
			 <li><a href="buy.php">管理金币</a></li>
          </ul>
        </div>
        <div id="mainCp">
          <div class="postForm">
            <div class="location">在线购买广告位</div>
              <form name="form2" action="buyad.php" method="post">
              <table width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="tbtitle" style="	background:#E2F5BC;">
        <input type="hidden" name="action" value="buy" />
        <input type="hidden" name="step" value="2" />
		<input type="hidden" name="adtype" value="<?php echo $sector['adtype'];?>" />
        <input type="hidden" name="cid" value="<?php echo $cid; ?>" />
		
		<tr>
        <td width="20%" height="35" align=right bgcolor="#FFFFFF">该广告位价格：</td>
        <td width="80%" bgcolor="#FFFFFF"> &nbsp;&nbsp; <?php echo $sector['price']; ?>金币/周</td>
    </tr>
	<tr>
        <td height="35" align=right bgcolor="#FFFFFF">您拥有金币数：</td>
        <td bgcolor="#FFFFFF"> &nbsp;&nbsp; <?php echo $memer['money']; ?></td>
    </tr>
	<tr>
        <td height="35" align=right bgcolor="#FFFFFF">您最多可以购买：</td>
        <td bgcolor="#FFFFFF"> &nbsp;&nbsp; <?php echo $morebuy; ?>周</td>
    </tr>
	<tr>
        <td height="35" align=right bgcolor="#FFFFFF">当前时间：</td>
        <td bgcolor="#FFFFFF"> &nbsp;&nbsp; <?php echo GetDateTimeMk($ntime)?></td>
    </tr>
	<tr>
       <td height="35" align="right" bgcolor="#FFFFFF">购买周数：</td>
       <td bgcolor="#FFFFFF"> &nbsp;&nbsp; <input name="times" type="text" value="" style="height:20px;font-size:14px; line-height:23px;"></td>
    </tr>
    <tr>
        <td height="35" align=right bgcolor="#FFFFFF">设置的广告内容：</td>
        <td bgcolor="#FFFFFF">&nbsp;(如果您投放的广告违反了相关法律，我们将删除该广告位！)</td>
    </tr>
<?php echo $nbody; ?>
	 
	  <tr>
        <td height="35" bgcolor="#FFFFFF">&nbsp;</td>
        <td bgcolor="#F8FCF1"><button class="button2" type="submit">提交</button></td>
    </tr>
    </table>
</form>
            <div class="clear"></div>
          </div>
        </div>
      </div>
  </div>
</div>
<?php include(DEDEMEMBER."/templets/foot.htm"); 
}
?> 



</body>
</html>